package xyz.lwm.lazycat.jdbc;

import xyz.lwm.lazycat.annotation.Bean;
import xyz.lwm.lazycat.annotation.ConditionalOnBean;
import xyz.lwm.lazycat.annotation.ConditionalOnMissingBean;
import xyz.lwm.lazycat.annotation.Configuration;
import xyz.lwm.lazycat.jdbc.exec.JdbcTemplate;

import javax.sql.DataSource;

/**
 * jdbc template configuration
 *
 * @author lwm
 */
@Configuration
@ConditionalOnBean(DataSource.class)
public class JdbcConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public JdbcTemplate jdbcTemplate(DataSource dataSource) {
        return new JdbcTemplate(dataSource);
    }

}
